﻿{% extends "base.html" %}
{% block scripts %}
{% endblock %}
{% block content %}
        		<h1>Обсуждения <img class="icon" src="/media/images/icon_arrow_1.gif" width="11" height="5"> {{ discussion.subj }}</h1>
				
				<div class="debate_block">
					<div class="block_header"> {{ discussion.subj }}</div>
					<div class="debate_author"><a href="/profile/{{ discussion.creator.id }}/">{{ discussion.creator.user_info.last_name }} {{ discussion.creator.user_info.first_name }}</a></div>
					
					<ul class="debate_mess_list">
						{% for message in discussion.messages.all %}
                        <li class="list_item{% if forloop.first %} list_item_first{% endif %}">
							<div class="author">
                                <a href="/profile/{{ message.publisher.id }}/">
                                    <img class="userpic"
                                             {% if message.publisher.user_info.avatar %}
                                                src="{{ message.publisher.user_info.avatar.url }}"
                                                {% if message.publisher.user_info.avatar.width > message.publisher.user_info.avatar.height %}
                                                width="44"
                                                {% else %}
                                                height="49"
                                                {% endif %}
                                             {% else %}
                                                src="/media/images/nophoto.jpg/" width="44" height="49"   {% endif %}
                                        />
                                    {{ message.publisher.user_info.last_name }} {{ message.publisher.user_info.first_name }}
                                </a>
                            </div>
							<div class="text">{{ message.text }}</div>
							<div class="date">{{ message.post_date }}</div>
							<!--
                            <ul class="options">
								<li class="item"><a href="#">Удалить</a></li>
								<li class="item"><a href="#">Редактировать</a></li>
							</ul>
							-->
						</li>
                        {% endfor %}
            		</ul>
					
					<div class="add_debate_mess">
                    <form action="/post_discussion_message/{{ discussion.id }}/" method="post">
        				 <img class="userpic"
                             {% if request.user.user_info.avatar %}
                             src="{{ request.user.user_info.avatar.url }}"
                             {% if request.user.user_info.avatar.width > request.user.user_info.avatar.height %}
                             width="44"
                             {% else %}
                             height="49"
                             {% endif %}
                             {% else %}
                             src="/media/images/nophoto.jpg/" width="44" height="49"   {% endif %}
                         />
						<textarea name="text" id="id_text" cols="40" rows="2" ></textarea>
						<input class="button" type="submit" value="Отправить">
					</form></div>
				</div>
{% endblock %}